using System.Collections.Generic;


namespace MSP.Graph
{
    public class Graph : IDisCOPGraph
    {
        #region Properties

        private List<IDisCOPNode> m_nodes;
        public List<IDisCOPNode> Nodes
        {
            get { return m_nodes; }
            set { m_nodes = value; }
        }

        #endregion  // Properties


        #region Constructor

        public Graph()
        {
            m_nodes = new List<IDisCOPNode>();
        }

        #endregion  // Constructor


        #region Functions

        public void AddNode(IDisCOPNode node)
        {
            m_nodes.Add(node);
        }


        public void AddEdge(IDisCOPNode node1, IDisCOPNode node2, object data)
        {
            // add the edge to the nodes
            node1.AddEdge(new Edge(node1, node2, data));
            node2.AddEdge(new Edge(node2, node1, data));
        }


        public IEnumerator<IDisCOPNode> GetNodesEnumerator()
        {
            return m_nodes.GetEnumerator();
        }

        #endregion  // Functions

    }
}
